"""Documentation about all HELPER function"""

import re
punctuation = re.compile(r'[-.?!,":;\'/()|0-9]')

#return the term list to frequency dictionary
def termListToTermFrequencyDictionary(term_list):
    term_frequency_dictionary = {}
    for e in term_list:
        if term_frequency_dictionary.has_key(e):
            term_frequency_dictionary[e] += 1
        else:
            term_frequency_dictionary[e] = 1
    return term_frequency_dictionary

#Join TFDict1 and TFDict2 become one in TFDict1
def joinTermFrequencyDictionary(TFDict1, TFDict2):
    for k in TFDict2:
        if TFDict1.has_key(k):
            TFDict1[k] += TFDict2[k]
        else:
            TFDict1[k] = TFDict2[k]


#if __name__ == '__main__':
#    dict1 = {"red":2, "big":1}
#    dict2 = {"red":1, "car":2}
#    joinTermFrequencyDictionary(dict1, dict2)
#    print dict1
#    term_list = ["red", "big", "car"]
#    print termListToTermFrequencyDictionary(term_list)
